<!--{template lyear:header_simple_start}-->
<!--{template lyear:header_simple_end}-->
<main class="bs-main-container">
	<div class="container-fluid">
		<!--{template right_header}-->
    <div class="card">
      <div class="card-body">
        <form id="appform" name="appform" class="form-horizontal" action="{MOD_URL}&op=space" method="post" >
          <input type="hidden" name="cloudsubmit" value="true" />
          <input type="hidden" name="formhash" value="{FORMHASH}" />
          <div class="table-responsive">
            <table class="table table-hover align-middle">
              <thead>
                <tr>
                  <th width="30">{lang sort}</th>
                  <th width="150">{lang storage_location}</th>
                  <th width="50">{lang default}</th>
                  <th>{lang used_surplus}</th>
                  <th width="50">&nbsp;</th>
                </tr>
              </thead>
              <!--{loop $list $value}-->
              <tr>
                <td width="40"><input type="text" class="form-control" name="disp[{$value[remoteid]}]" value="$value[disp]" style="width:45px;" /></td>
                <td><input type="text" class="form-control"   name="name[{$value[remoteid]}]" value="$value[name]"  /></td>
                <td><input type="radio" class="form-check-input" name="isdefault" value="$value[remoteid]" <!--{if $value[isdefault]>0}-->checked<!--{/if}--> <!--{if $value[available]<1}-->disabled="disabled"<!--{/if}-->></td>
                <td><div id="spaceinfo_{$value[remoteid]}"> <span class="spacesize" style="padding:0 5px">$value[fusesize]&nbsp;/&nbsp;$value[ftotalsize]</span> <span class="spacecheck" style="padding:0 5px"><a href="javascript:;" title="{lang to_obtain}" onclick="checkspace(this,'$value[remoteid]')"><i class="mdi mdi-refresh"></i></a></span> 
                    <!--{if $value[available]<1}--> 
                    <span class="text-danger">{lang space_storage_failure}</span> 
                    <!--{/if}-->
                  </div></td>
                <td><a id="delete_{$value[remoteid]}" <!--{if $value[bz]=='dzz' || $value['usesize']>0}-->style="display:none"<!--{/if}-->class="btn btn-outline-danger btn-sm" href="{MOD_URL}&op=space&do=delete&remoteid=$value[remoteid]" onclick="if(confirm('{lang space_del_storage}')){return true;}else{return false}" title="{lang delete}"><i class="mdi mdi-delete"></i></a></td>
              </tr>
              <!--{/loop}-->
              <thead>
                <th valign="middle" colspan="7"><input type="submit" class="btn btn-primary bodyloading" value="{lang save_set}" /> <a href="{MOD_URL}&op=spaceadd" title="{lang add_storage_location}" class="btn btn-outline-primary">{lang add_storage_location}</a>
                  </thead>
            </table>
          </div>
        </form>
        <div class="mt-2 alert alert-warning alert-dismissible fade show" role="alert">
          <strong>{lang board_message}</strong><ul class="mb-0">{lang space_board_message_text}</ul>
          <button type="button" class="btn-close" data-dismiss="alert" aria-label="Close"></button>
        </div>
      </div>
    </div>
  </div>
</main> 
<script type="text/javascript">
 function checkspace(obj,remoteid){
	 jQuery(obj).html('<img src="static/image/common/loading.gif">');
	 jQuery.getJSON('{MOD_URL}&op=space&do=checkspace&remoteid='+remoteid,function(json){
		 if(json.error){
			 jQuery(this).html('<i class="mdi mdi-refresh"></i><span class="text-danger">'+json.error+'</span>');
		 }else{
				jQuery('#spaceinfo_' + remoteid + ' .spacecheck a').html('<span class="text-success" >{lang already_update}</span>');
		 	jQuery('#spaceinfo_'+remoteid+' .spacesize').html(json.fusesize+'&nbsp;/&nbsp;'+json.ftotalsize).hide().fadeIn('slow');
			if(json.usesize<1){
				jQuery('delete_'+remoteid).show();
			}else{
				jQuery('delete_'+remoteid).hide();
			}
			
			window.setTimeout(function(){
				jQuery('#spaceinfo_'+remoteid+' .spacecheck a').html('<i class="mdi mdi-refresh"></i>');
			},5000);
		 }
	 });
 }
</script>
<!--{template lyear:footer_simple}--> 
